package com.bit101.components
{
	import flash.display.Bitmap;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.filters.DropShadowFilter;
	
	public class ImageEmbedButton extends Sprite
	{
		private var drop:DropShadowFilter = new DropShadowFilter(10,45,0,0.5);
		public function ImageEmbedButton(parent:DisplayObjectContainer=null, xpos:Number=0, ypos:Number=0,source:Class=null,defaultHandler:Function = null)
		{
			var img:Bitmap = new source;
			addChild(img);
			this.width = img.width;
			this.height = img.height;
			parent.addChild(this);
			this.x = xpos;
			this.y = ypos;
			this.addEventListener(MouseEvent.ROLL_OVER,onMouseOver);
			this.addEventListener(MouseEvent.ROLL_OUT,onMouseOut);
			if(defaultHandler != null)
			{
				addEventListener(MouseEvent.CLICK, defaultHandler);
			}
		}
		private function onMouseOver(event:MouseEvent):void{
			this.y --;
			//this.filters = [drop]
		}
		private function onMouseOut(event:MouseEvent):void{
			this.y ++;
			this.filters = null;
		}
	}
}